Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useUpdateEffect hook #322

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

firstchair
Copy link

@firstchair firstchair commented Mar 1, 2024

A modified useEffect hook with a guard to check whether if it's the first mount or not.
This can be seen as an anti-pattern but I think its still handy in a lot of real life use cases.

It also includes a useIsFirstRender hook, this hook is a useful for determining whether the current render is the first render of a component.

Copy link
Member

@ThaNarie ThaNarie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments, otherwise 👍

src/hooks/useUpdateEffect/useUpdateEffect.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/hooks/useUpdateEffect/useUpdateEffect.ts Outdated Show resolved Hide resolved
src/hooks/useUpdateEffect/useUpdateEffect.mdx Outdated Show resolved Hide resolved
@firstchair firstchair requested a review from ThaNarie March 1, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants